package org.example.leetCode;

/**
 * @author Administrator
 */
public class FindContinuousSequence {
    public int[][] findContinuousSequence(int target) {
        if (target == 0) {
            return null;
        }
        int[][] res = new int[target][target];
        int sum = 0;
        int cur = 0;
        int temp = 0;
        for (int i = 1; ; i++) {
            for (int j = i; sum < target; j++) {
                sum += j;
                res[cur][temp++] = j;
                if (sum == target) {
                    break;
                } else if (sum > target) {
                    if (j - i == 1) {
                        return res;
                    }
                }
            }
        }
    }
}
